package com.lilicould.dao;

import com.lilicould.entity.Users;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

public interface UserDao {

    // 根据学工号查询用户信息
    @Select("select * from users where user_no = #{userNo}")
    Users getUserByUserNo(String userNo);

    // 添加用户
    @Insert("insert into users (user_no, password, role, name) values(#{userNo}, #{password}, #{role},#{name})")
    int addUser(Users user);

    // 删除用户
    @Delete("delete from users where user_no = #{userNo}")
    int deleteUser(String userNo);

    // 修改用户信息
    @Insert("update users set password = #{password}, role = #{role}, name = #{name} where user_no = #{userNo}")
    int updateUser(Users user);
}
